<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <input type="text" name="" id=""> <button>发送</button>
    <script>
        var btn = document.querySelector('button')
        var time = 5;
        btn.addEventListener('click', function() {
            btn.disabled = true
            var timer = setInterval(function() {
                if (time == 0) {
                    clearInterval(timer);
                    btn.disabled = false
                    btn.innerHTML = '发送'
                    time = 5
                } else {
                    btn.innerHTML = `还剩下${time}s`
                    time--
                }
            }, 1000)

        })
    </script>
</body>

</html>